# SpeedoMeter.Debug


# Properties

| Data Type | Property Name | Default Value | Description |
| --- | --- | --- | --- |
| Boolean | `SpeedoMeter.Debug.ENABLED` | false | Enable/disable debug mode. |


# Methods

## `print`

Prints a debug message to the console.

**Signature:**

```Lua
SpeedoMeter.Debug:print( msg )
```

**Returns:** None.

**Parameters:**

1. (String) The message.


# SpeedoMeter.Game


# Properties

| Data Type | Property Name | Default Value | Description |
| --- | --- | --- | --- |
| Boolean | `SpeedoMeter.Game.IS_3D_MOVEMENT` | true | Enable/disable the z-axis calculation. |


# Methods

## `VectorLength`

Returns the length of a vector table.

**Signature:**

```Lua
SpeedoMeter.Game:VectorLength( vectorTable , is3D )
```

**Returns:** (Float) The vector length.

**Parameters:**

1. (Vector table) The vector to calculate.

2. (Boolean) True if you want to calculates a 3D vector. Otherwise, sets it false.


# Subroutines

## OnUpdate hook

Internal essential function.

If you are overriding `Game.Rule:OnUpdate`, then calls this function inside of it.

Failed to do so causing the library malfunction.

**Signature:**

```Lua
SpeedoMeter.Game:OnUpdate( time )
```


# SpeedoMeter.Game.Player


# Methods

## `GetSpeed`

Returns the player's movement speed.

**Signature:**

```Lua
SpeedoMeter.Game.Player:GetSpeed( index )
```

**Returns:**

* (Float) The player's speed.

  **or**

* `nil` if invalid index or player's speed sync variable is not exists. 

**Parameters:**

1. (Integer) The player entity index.



## `GetByIndex`

Gets a player object by given index.

Similar to `Game.Player:Create()` but this function truly returns `nil` when the player is invalid.

**Signature:**

```Lua
SpeedoMeter.Game.Player:GetByIndex( index )
```

**Returns:**

* (Player object) The player.

  **or**

* `nil` if invalid index or not exists.

**Parameters:**

1. (Integer) The player entity index.


## `IsAlive`

Checks whether the player is alive.

**Signature:**

```Lua
SpeedoMeter.Game.Player:IsAlive( player )
```

**Returns:** (Boolean) Returns true if player is valid and alive. Otherwise, returns false.

**Parameters:**

1. (Player object) The player.


# SpeedoMeter.UI


# Methods

## `GetSpeed`

Returns the player's speed.

**Signature:**

```Lua
SpeedoMeter.UI:GetSpeed()
```

**Returns:**

* (Float) The player's speed.

  **or**

* `nil` if player's speed sync variable is not exists or not synchronized. 

**Parameters:** None.


## `UpdateHUD`

Updates the player's speed HUD.

**Signature:**

```Lua
SpeedoMeter.UI:UpdateHUD()
```

**Returns:** None.

**Parameters:** None.


# SpeedoMeter.UI.Text


# Properties

| Data Type | Property Name | Default Value | Description |
| --- | --- | --- | --- |
| SetArg table | `SpeedoMeter.UI.Text.PlayerSpeed.Config` | nil | The configuration parameters for speedometer UI text label. |
| SyncValue object | `SpeedoMeter.UI.Text.PlayerSpeed.Instance` | nil | Instance of speedometer UI text label. |


# SpeedoMeter.SyncValue


# Properties

| Data Type | Property Name | Default Value | Description |
| --- | --- | --- | --- |
| String | `SpeedoMeter.SyncValue.PlayerSpeed.NAME` | "SoM.Player.%i" | `PlayerSpeed` sync variable name format. |
| Table | `SpeedoMeter.SyncValue.PlayerSpeed.Instances` | empty | Instance of all `PlayerSpeed` sync variable. Game module only. |
| SyncValue object | `SpeedoMeter.SyncValue.PlayerSpeed.Instance` | nil | Instance of `PlayerSpeed` sync variable. UI module only. |

